
#ifndef __RATE_CONTROL_H
#define __RATE_CONTROL_H

#include <deque>

/** Defines a very simple rate control (constant rate) algorithm. */
class RateControl
{
   public:
      RateControl(int64_t ibytes_per_second, double icongestion_window_size);
      void blockUntilAllowed(int datasize);
      int prepareForSend(int32_t packet_id, int datasize);
   protected:
      /** Collection of the previous n packets. */
      std::deque<std::pair<int64_t, int> > data_collection;
      /** Congestion window size. */
      double congestion_window_size;
      /** Rate limited to this many bytes per second. */
      int64_t bytes_per_second;
};

#endif
